<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/includeTop.jsp" %>
<%@ include file="/WEB-INF/jsp/includeTaglib.jsp" %>

<table width="100%" border="0" cellpadding="0" cellspacing="5">
  <tr>
    <td valign="top">
      <table class="dbborder" width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="bottom" class="blueTableBg">&nbsp;通信规则模板管理&nbsp;-&nbsp;编辑模板</td>
        </tr>
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="5">
              <tr>
                <td>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="dashTopLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTop" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTopRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td align="center">
                        <table width="100%" border="0" cellpadding="0" cellspacing="3">
                          <form id="editRuleTemplateForm" method="post">
		                      <input type="hidden" name="updatekey" value="${ruleTemplate.id}">
                          <tr>
                             <td width="114" height="20" class="globalText">发送次数</td>
                            	<td height="20" class="globalText">
                            	<input id="sendCount" type="text" class="txtbox" size="20" name="sendCount" value="${ruleTemplate.sendCount}"/>次
                           		</td>
                          </tr>
                          <tr>
                            <td width="114" height="20" class="globalText">延迟时间</td>
                            <td height="20" class="globalText">
                            <input id="sendInterval" type="text" class="txtbox" size="20" name="sendInterval" value="${ruleTemplate.sendInterval}"/>小时
                            </td>
                          </tr>
                          <tr>
                            <td width="114" height="20" class="globalText">通信规则模板描述</td>
                            <td height="20" class="globalText">
                            	<input id="description" type="text" class="txtbox" size="20" name="description" value="${ruleTemplate.description}"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="center" colspan="2">
                              <table border="0" cellpadding="0" cellspacing="2">
                                <tr>
                                  <td><input type="button" class="btnStyle" value="  保存  " onclick="javascript:doSubmit()"></td>
                                  <td><input type="button" class="btnStyle" value="  取消  " onclick="javascript:doCancel()"></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                          </form>
                        </table>
                      </td>
                      <td class="dashRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashBottomLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottom" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottomRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<script language="javascript">
	
	function doSubmit(){
    var sendCount = document.getElementById("sendCount").value.trim();
		if (!validatePositiveInteger(sendCount)) {
			alert("发送次数 必须是正整数");
			return false;
		}
		
    var sendInterval = document.getElementById("sendInterval").value.trim();
		if (!validatePositiveInteger(sendInterval)) {
			alert("延迟时间 必须是正整数");
			return false;
		}
		
    var description = document.getElementById("description").value.trim();
		if (validateEmpty(description)) {
			alert("通信规则描述 不能为空");
			return false;
		}
		
		document.getElementById("editRuleTemplateForm").action = "<c:url value='editRuleTemplate.html' />";
		document.getElementById("editRuleTemplateForm").submit();
	}
	
	function doCancel(){
		document.getElementById("editRuleTemplateForm").action = "<c:url value='ruleTemplateMain.html' />";	
		document.getElementById("editRuleTemplateForm").submit();
	}

</script>